package org.luckystrophe.snowtoms.model.impl;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnDismissListener;

import com.googlecode.androidannotations.annotations.EBean;

@EBean
public class MyProgressDialog {

	private ProgressDialog pDialog;

	public void showProgressDialog(Context context, OnCancelListener cancelListener, OnDismissListener dismissListener) {
		pDialog = new ProgressDialog(context);
		pDialog.setMessage("로딩중 입니다..");
		pDialog.setTitle("");
		pDialog.setMax(1);
		pDialog.setCancelable(true);
		pDialog.setOnCancelListener(cancelListener);
		pDialog.setOnDismissListener(dismissListener);
		pDialog.setCanceledOnTouchOutside(false);
		pDialog.show();
	}

	public void cancelProgressDialog() {
		if (pDialog.isShowing()) {
			pDialog.dismiss();
		}
	}

}
